//
//  UIBarButtonItem+OSExtension.m
//  百思不得姐
//
//  Created by gl on 16/2/19.
//  Copyright © 2016年 CoderC. All rights reserved.
//

#import "UIBarButtonItem+OSExtension.h"

@implementation UIBarButtonItem (OSExtension)
+(instancetype)itemWithImageName:(NSString*)imageName highImageName:(NSString*)hignImageName target:(id)target action:(SEL)action{
    
    UIButton *button = [[UIButton alloc]init];
    [button setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:hignImageName] forState:UIControlStateHighlighted];
    button.size = button.currentBackgroundImage.size;
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return [[UIBarButtonItem alloc]initWithCustomView:button];
    
}
@end
